<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>三角形</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        canvas {
            background-color: rgba(223, 215, 215, 0.3);
        }
    </style>
</head>
<body>
    <canvas width="500" height="500"></canvas>

    <script>
        let canvas = document.querySelector('canvas')
        const ctx = canvas.getContext('2d')
        ctx.beginPath()
       
        ctx.moveTo(100, 100)
        ctx.lineTo(200,100)
        ctx.lineTo(150, 180)
        ctx.closePath()
        ctx.lineCap="round"
        
        ctx.strokeStyle = 'red'
        ctx.lineWidth = '10'
        ctx.stroke()
    </script>
</body>
</html>